package display;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.springframework.web.context.*;
import domain.SubCategoriaRepository;
import domain.SubCategoria;
import util.SubCategoriaDTO;
import util.SubCategoriaAssembler;
public class ListaSubCategorias extends PageController {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
SubCategoriaRepository subcategorias =
(SubCategoriaRepository) context.getBean("SubCategoriaRepository");
try {
Collection lista = subcategorias.findAllSubCategoria();
List data = new ArrayList();
Iterator itr = lista.iterator();
while (itr.hasNext()) {
SubCategoria prof = (SubCategoria)itr.next();
SubCategoriaDTO dto = SubCategoriaAssembler.CreateDTO(prof);
data.add(dto);
}
request.setAttribute("subcategorias",data);
forward("/listaSubCategorias.jsp",request,response);
} catch (Exception e) {
request.setAttribute("mensaje",e.getMessage());
forward("/paginaError.jsp",request,response);
}
}}